package jtk.project4.fleet.ibatis.dao;

import java.sql.SQLException;
import java.util.List;

import jtk.project4.fleet.domain.RprList;

import nl.coderight.jazz.dialog.MessageDialog;
import nl.coderight.jazz.dialog.MessageType;




public class RprListsDao extends IbatisDao{
	
	public List selectRprLists() throws SQLException {
		List selectRprLists = null;
			selectRprLists =getSqlMap().queryForList("SELECT_ALL_RPRLIST", null);
		return selectRprLists;
	}

	public int deleteRprList(RprList rprlist) throws SQLException{
		return (int) getSqlMap().delete("DELETE_RPRLIST", rprlist);
	}
	
	public int updateRprList(RprList rprlist) throws SQLException{
		return (int) getSqlMap().update("UPDATE_RPRLIST", rprlist);
	}
	
	public RprList insertRprList(RprList rprlist) throws SQLException{
		return (RprList) getSqlMap().insert("INSERT_RPRLIST", rprlist);
	}

	/*public RprList insertRprListType(RprList rprlist) throws SQLException {
		return (RprList) getSqlMap().insert("INSERT_VENDOR_TYPE", rprlist);
	}
	
		public List selectRprListType() throws SQLException {
		return getSqlMap().queryForList("SELECT_ALL_VENDOR_TYPE", null);
	}*/
	
		
	public static void main (String args[]) throws SQLException{
		 
		RprList rprlist;
		rprlist = new RprList(); 
		rprlist.setRepair("cobacoba");
		/*insert
		rprlist.setRepairId(214);
		new RprListsDao().insertRprList(rprlist);
		System.out.println("RepairID: "+rprlist.getRepairId()+ " telah di insert pada DB");
		System.out.println("Repair: "+rprlist.getRepair()+ " telah di insert pada DB");*/
		
		List<RprList> cba;
		rprlist = new RprList();
		cba = new RprListsDao().selectRprLists();
		System.out.println(cba.size());
		
		//new RprListsDao().insertRprList(); 
		
		
		/*update
		rprlist.setRepairId(100);
		rprlist.setRepair("update"); 
		new RprListsDao().updateRprList(rprlist);*/
		
		/*delete rprlist.setRepairId(10);
		new RprListsDao().deleteRprList(rprlist);
		System.out.println("update repair dengan id ="+rprlist.getRepairId()+ " ,telah didelete"); */
		
		}
	
}